package com.example.shop.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.shop.pojo.EvaluationUserThumbUp;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface EvaluationUserThumbUpMapper extends BaseMapper<EvaluationUserThumbUp> {
    @Select("select * from r_evaluation_user_thumb_up where evaluation_id=#{evaluationId}")
    List<EvaluationUserThumbUp> selectById(Long evaluationId);
    /**
     * count(*): 统计所有列，相等于求记录总行，不会忽略null
     * count(1): 会统计表中所有记录数，不会忽略null，包含null的记录
     * count(列名): 会统计给列字段在表中出现的次数，会忽略字段为null的情况，即不统计为null的记录
     * 效率从上到下依次高效
     */
    @Select("select count(user_id) from r_evaluation_user_thumb_up where evaluation_id = #{evaluationId}")
    int count(Long evaluationId);
}
